﻿#ifndef FROZENCOLUMNTABLEWIDGET_H
#define FROZENCOLUMNTABLEWIDGET_H

#include <QTableView>


class FrozenColumnTableWidget : public QTableView
{
    Q_OBJECT

public:
    FrozenColumnTableWidget();
    FrozenColumnTableWidget(QAbstractItemModel *model);
    ~FrozenColumnTableWidget();

protected:
    virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
    virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)Q_DECL_OVERRIDE;
    void scrollTo(const QModelIndex & index, ScrollHint hint=EnsureVisible) Q_DECL_OVERRIDE;
private:
    QTableView *frozenTableView;
    void init();
    void updateFrozenTableGeometry();

private slots:
    void updateSectionWidth(int logicalIndex, int oldSize, int newSize);
    void updateSectionHeight(int logicalIndex, int oldSize, int newSize);
};

#endif // FROZENCOLUMNTABLEWIDGET_H
